#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <wait.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include "get_index.h"

void
preprocesser_cpp(char *fichier, int fd_socket)
{ 
  if(fork()==0)
    {
      dup2(fd_socket,STDOUT_FILENO);
      close(fd_socket);
      execlp("cpp","cpp","-P",fichier,NULL);
      perror("erreur cpp");
      exit(1);
    }

  wait(NULL);
    
}
 
/*int
main(int argc, char *argv[])
{
  int fd = open("toto",O_WRONLY | O_CREAT | O_TRUNC, 0640);
  preprocesser_cpp("/autofs/netapp/account/cremi/pmilian/new-http/serveur-http-new/www/cpp/test.html.cpp",fd);


  printf("strlen %d\n",strlen("/autofs/netapp/account/cremi/pmilian/new-http/serveur-http-new/www/cpp/test.html.cpp"));

  //existe_cpp_correspondant(argv[1], argv[2]);
  return EXIT_SUCCESS;
  }
*/
